/**
 * Created by AllanXu on 01/03/2016.
 */
define(function (require) {
	var Vue = require('vue'),
        Config = require('config'),
		_ = require('ajax'),
		utilities = require('utilities')

	var typeId = utilities.getParameterByName('typeId');
    var qtid = sessionStorage.qtid;
    console.log(qtid);
	var app = new Vue({
		el: '#enroll_activity',
		data: {
		    thumb: true,
		    mainInfo: '',
            qtid:'',
            member:'',
            applied: [],
            showFlag: false,
            rowCount: '',
			picServer: Config.picServer
		},
		methods:{
			init: function () {
				if(qtid!=null){
				    app.qtid=qtid;
                    _(Config.SERVICE.MATES.ENTOLL + '?id=' + qtid, {}, function (data) {
                        app.member = data.obj;
                        _(Config.SERVICE.ACTIVITY.ENROLLDETAILS+'?id='+typeId+'&phone='+app.member.phone, {}, function(data) {
                            app.mainInfo = data.obj;
                        });
                    });
				}else{
                	_(Config.SERVICE.ACTIVITY.ENROLLDETAILS+'?id='+typeId, {}, function(data) {
                    	app.mainInfo = data.obj;
                	});
                }
                _(Config.SERVICE.ACTIVITY.ENROLLAPPLIEDS+'?blind.id='+typeId, {}, function(data) {
                    app.applied = data.pageitems;
                    app.rowCount = data.rowcount;
                });
			},
            goDetail: function(id){
                window.location.href = "enroll_detail.html?id=" +id;
            },
            apply:function(){
                window.location.href = "enroll_sign.html?id=" +typeId;
			},
            login:function(){
                window.location.href = "enroll_login.html?id=" +typeId;
            },
            goDetailQd:function(id){
                window.location.href = "enroll_activeRank.html?id=" +id;
			}
		}
	});
	app.init();
});
